package com.community.controller;

import com.community.bean.SysDict;
import com.community.interceptor.Auth;
import com.community.service.DictService;
import com.community.util.Result;
import com.community.util.Search;
import com.feng.fengDUtil.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Auth("字典")
@RestController
@RequestMapping(value = "/dict")
public class DictAction {
    @Autowired
    private DictService dictService;

    @RequestMapping(value = "/list")
    public Result list(Page page, Search search) {
        dictService.query(page,search);
        return Result.success(page);
    }


    @RequestMapping(value = "/getDict")
    public Result getDict(String dictType) {
        return Result.success(dictService.getDict(dictType));
    }

    @RequestMapping(value = "/save")
    public Result save(@RequestBody SysDict dict) {
        dictService.saveDict(dict);
        return Result.success(dict);
    }



}
